extends "../haiwangxing-3/haiwangxing-3.gd"


var baseId = ""
var upText1 = "战斗辅助造成的治疗量提高25%"
var upText2 = "海之女神造成的伤害提高40%"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("每{cd}秒随机向30个单元格发射冰晶，被击中的友军恢复全部生命值，被击中的敌人受到[炮击*2]({damage})的伤害", "海之女神", "seaGod", 10)
var p4 = 1
func upgrade():
	.upgrade()
	if upgraded == 1:
		p2 = 1.25
	if upgraded == 2:
		p4 = 1.4

func _castCdSkill(id):
	._castCdSkill(id)
	if id=="seaGod":
		seaGod()

func seaGod():
	var cells = []
	utils.createSkillTextEff("海之女神", position)
	for i in range(30):
		var c = utils.getRndCell(0)
		while cells.has(c):
			c = utils.getRndCell(0)
			yield(reTimer(0.02),"timeout")
		cells.append(c)
	for i in cells:
		createCustEff(sys.main.map.map_to_world(i), "eff/bingCi", 15, false, 1.3, Vector2(0, -20))
		var cha = matCha(i)
		if cha != null:
			if cha.team == team:
				healCha(cha, cha.att.maxHp)
			else:
				azurHurtChara(cha, getSkillEffect("海之女神"), sys.HurtType.WEAPON, sys.AtkType.SKILL, "海之女神", false, p4)

func getSkillEffect(name):
	.getSkillEffect(name)
	if name == "海之女神":
		return att.atk * 2